package net.zjitc.controller;

import net.zjitc.pojo.Admin;
import net.zjitc.service.AdminService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;

@Controller
@RequestMapping("/admin")
public class AdminController {
    @Autowired
    private AdminService adminService;
    @PostMapping("/login")
    public String login(Admin admin, Model model){
        Admin admin1 = adminService.findAdmin(admin.getUsername());
        if (admin1!=null){
            model.addAttribute("msg","查询成功");
            return "success";
        }
        model.addAttribute("msg","用户名或密码错误");
        return "index";
    }
}
